import java.util.Deque;
import java.util.LinkedList;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ws
 * Date: 2023-02-12
 * Time: 15:13
 */
public class Solution1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            String s = scanner.nextLine();
            int sl = s.length();
            Deque<Character> stack = new LinkedList<>();
            stack.push(s.charAt(0));
            for (int i = 1; i < sl; i++) {
                char ch = s.charAt(i);
                if (stack.isEmpty()) {
                    stack.push(ch);
                } else if (stack.peek() != ch) {
                    stack.push(ch);
                } else {
                    stack.pop();
                }
            }
            if (stack.isEmpty()) {
                System.out.println(0);
                continue;
            }
            StringBuilder stringBuilder = new StringBuilder();
            while (!stack.isEmpty()) {
                stringBuilder.append(stack.pop());
            }
            System.out.println(stringBuilder.reverse().toString());
        }
    }
}
